<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>miniFOC: system/system.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectlogo"><img alt="Logo" src="Acme_LOGO.png"/></td>
  <td id="projectalign">
   <div id="projectname">miniFOC<span id="projectnumber">&#160;1.0.3</span>
   </div>
   <div id="projectbrief">This open-source project aims to accomplish a FOC(Field Oriented Control) scheme that is operatable with minimum costs in China.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_262ef3e34820216e073ea116856421e0.html">system</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle"><div class="title">system.c File Reference</div></div>
</div><!--header-->
<div class="contents">

<p>system basic function source file  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;gd32f1x0.h&quot;</code><br />
<code>#include &quot;<a class="el" href="system_8h_source.html">system.h</a>&quot;</code><br />
</div>
<p><a href="system_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a35f0081c3632bdd1851b3b0180812224"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="system_8c.html#a35f0081c3632bdd1851b3b0180812224">systick_config</a> (void)</td></tr>
<tr class="memdesc:a35f0081c3632bdd1851b3b0180812224"><td class="mdescLeft">&#160;</td><td class="mdescRight">initialize systick timer to implementation delay function  <a href="system_8c.html#a35f0081c3632bdd1851b3b0180812224">More...</a><br /></td></tr>
<tr class="separator:a35f0081c3632bdd1851b3b0180812224"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a837b6e9a8c812f0964f71e37ac853bff"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="system_8c.html#a837b6e9a8c812f0964f71e37ac853bff">delayms</a> (unsigned long count)</td></tr>
<tr class="memdesc:a837b6e9a8c812f0964f71e37ac853bff"><td class="mdescLeft">&#160;</td><td class="mdescRight">millisecond delay function, any time time.  <a href="system_8c.html#a837b6e9a8c812f0964f71e37ac853bff">More...</a><br /></td></tr>
<tr class="separator:a837b6e9a8c812f0964f71e37ac853bff"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a713199ab95f480628d6658708ed8de8b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="system_8c.html#a713199ab95f480628d6658708ed8de8b">delay_decrement</a> (void)</td></tr>
<tr class="memdesc:a713199ab95f480628d6658708ed8de8b"><td class="mdescLeft">&#160;</td><td class="mdescRight">delay counter decrement function, called by systick handler  <a href="system_8c.html#a713199ab95f480628d6658708ed8de8b">More...</a><br /></td></tr>
<tr class="separator:a713199ab95f480628d6658708ed8de8b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7e7cece1b30ef67968b244698f999b0e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="system_8c.html#a7e7cece1b30ef67968b244698f999b0e">user_memset</a> (void *buf, unsigned char data, unsigned char num)</td></tr>
<tr class="memdesc:a7e7cece1b30ef67968b244698f999b0e"><td class="mdescLeft">&#160;</td><td class="mdescRight">format buffer array to fixed value, replace memset function  <a href="system_8c.html#a7e7cece1b30ef67968b244698f999b0e">More...</a><br /></td></tr>
<tr class="separator:a7e7cece1b30ef67968b244698f999b0e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7bee5a9ca4038926b7fd4c38976d1481"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="system_8c.html#a7bee5a9ca4038926b7fd4c38976d1481">float_to_int32</a> (float data0)</td></tr>
<tr class="memdesc:a7bee5a9ca4038926b7fd4c38976d1481"><td class="mdescLeft">&#160;</td><td class="mdescRight">convert floating point numbers to int32 type data  <a href="system_8c.html#a7bee5a9ca4038926b7fd4c38976d1481">More...</a><br /></td></tr>
<tr class="separator:a7bee5a9ca4038926b7fd4c38976d1481"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ade748eddd7c60c3bf4c67bce9c463545"><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="system_8c.html#ade748eddd7c60c3bf4c67bce9c463545">int32_to_float</a> (unsigned int data0)</td></tr>
<tr class="memdesc:ade748eddd7c60c3bf4c67bce9c463545"><td class="mdescLeft">&#160;</td><td class="mdescRight">convert int32 to floating point numbers type data  <a href="system_8c.html#ade748eddd7c60c3bf4c67bce9c463545">More...</a><br /></td></tr>
<tr class="separator:ade748eddd7c60c3bf4c67bce9c463545"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:adfdeec3bd66b51d01833f44ec130c0cb"><td class="memItemLeft" align="right" valign="top">static volatile unsigned long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="system_8c.html#adfdeec3bd66b51d01833f44ec130c0cb">delayms_counter</a> = 1</td></tr>
<tr class="memdesc:adfdeec3bd66b51d01833f44ec130c0cb"><td class="mdescLeft">&#160;</td><td class="mdescRight">millisecond delay function count variable  <a href="system_8c.html#adfdeec3bd66b51d01833f44ec130c0cb">More...</a><br /></td></tr>
<tr class="separator:adfdeec3bd66b51d01833f44ec130c0cb"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >system basic function source file </p>
<dl class="section author"><dt>Author</dt><dd>Lao·Zhu </dd></dl>
<dl class="section version"><dt>Version</dt><dd>V1.0.2 </dd></dl>
<dl class="section date"><dt>Date</dt><dd>29. October 2021 </dd></dl>

<p class="definition">Definition in file <a class="el" href="system_8c_source.html">system.c</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a713199ab95f480628d6658708ed8de8b" name="a713199ab95f480628d6658708ed8de8b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a713199ab95f480628d6658708ed8de8b">&#9670;&nbsp;</a></span>delay_decrement()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void delay_decrement </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>delay counter decrement function, called by systick handler </p>

<p class="definition">Definition at line <a class="el" href="system_8c_source.html#l00038">38</a> of file <a class="el" href="system_8c_source.html">system.c</a>.</p>

<p class="reference">References <a class="el" href="system_8c_source.html#l00015">delayms_counter</a>.</p>

<p class="reference">Referenced by <a class="el" href="gd32f1x0__it_8c_source.html#l00077">SysTick_Handler()</a>.</p>

</div>
</div>
<a id="a837b6e9a8c812f0964f71e37ac853bff" name="a837b6e9a8c812f0964f71e37ac853bff"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a837b6e9a8c812f0964f71e37ac853bff">&#9670;&nbsp;</a></span>delayms()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void delayms </td>
          <td>(</td>
          <td class="paramtype">unsigned long&#160;</td>
          <td class="paramname"><em>count</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>millisecond delay function, any time time. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">count</td><td>time to delay (in milliseconds) </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="system_8c_source.html#l00030">30</a> of file <a class="el" href="system_8c_source.html">system.c</a>.</p>

<p class="reference">References <a class="el" href="system_8c_source.html#l00015">delayms_counter</a>.</p>

<p class="reference">Referenced by <a class="el" href="encoder_8c_source.html#l00119">encoder_zeroing()</a>, <a class="el" href="foc_8c_source.html#l00033">foc_calibrate_phase()</a>, <a class="el" href="main_8c_source.html#l00139">main()</a>, and <a class="el" href="report_8c_source.html#l00015">report_local_variable()</a>.</p>

</div>
</div>
<a id="a7bee5a9ca4038926b7fd4c38976d1481" name="a7bee5a9ca4038926b7fd4c38976d1481"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7bee5a9ca4038926b7fd4c38976d1481">&#9670;&nbsp;</a></span>float_to_int32()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int float_to_int32 </td>
          <td>(</td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>data0</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>convert floating point numbers to int32 type data </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">data0</td><td>floating point type data to be converted </td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">converted</td><td>int32 type data </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="system_8c_source.html#l00060">60</a> of file <a class="el" href="system_8c_source.html">system.c</a>.</p>

<p class="reference">Referenced by <a class="el" href="flash_8c_source.html#l00026">flash_write_parameters()</a>, <a class="el" href="report_8c_source.html#l00069">report_angle_speed()</a>, and <a class="el" href="report_8c_source.html#l00015">report_local_variable()</a>.</p>

</div>
</div>
<a id="ade748eddd7c60c3bf4c67bce9c463545" name="ade748eddd7c60c3bf4c67bce9c463545"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ade748eddd7c60c3bf4c67bce9c463545">&#9670;&nbsp;</a></span>int32_to_float()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">float int32_to_float </td>
          <td>(</td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>data0</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>convert int32 to floating point numbers type data </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">data0</td><td>int32 type data to be converted </td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">converted</td><td>floating point type data </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="system_8c_source.html#l00070">70</a> of file <a class="el" href="system_8c_source.html">system.c</a>.</p>

<p class="reference">Referenced by <a class="el" href="flash_8c_source.html#l00046">flash_read_parameters()</a>, and <a class="el" href="main_8c_source.html#l00028">mdtp_callback_handler()</a>.</p>

</div>
</div>
<a id="a35f0081c3632bdd1851b3b0180812224" name="a35f0081c3632bdd1851b3b0180812224"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a35f0081c3632bdd1851b3b0180812224">&#9670;&nbsp;</a></span>systick_config()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void systick_config </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>initialize systick timer to implementation delay function </p>

<p class="definition">Definition at line <a class="el" href="system_8c_source.html#l00020">20</a> of file <a class="el" href="system_8c_source.html">system.c</a>.</p>

<p class="reference">Referenced by <a class="el" href="main_8c_source.html#l00139">main()</a>.</p>

</div>
</div>
<a id="a7e7cece1b30ef67968b244698f999b0e" name="a7e7cece1b30ef67968b244698f999b0e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7e7cece1b30ef67968b244698f999b0e">&#9670;&nbsp;</a></span>user_memset()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void user_memset </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char&#160;</td>
          <td class="paramname"><em>num</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>format buffer array to fixed value, replace memset function </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">buf</td><td>array to format </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">data</td><td>value to be formatted as </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">num</td><td>number of elements to format </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="system_8c_source.html#l00049">49</a> of file <a class="el" href="system_8c_source.html">system.c</a>.</p>

<p class="reference">Referenced by <a class="el" href="filter_8c_source.html#l00028">filter_coefficient_config()</a>, <a class="el" href="uart_8c_source.html#l00036">mdtp_receive_handler()</a>, and <a class="el" href="pid_8c_source.html#l00033">pid_config()</a>.</p>

</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="adfdeec3bd66b51d01833f44ec130c0cb" name="adfdeec3bd66b51d01833f44ec130c0cb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adfdeec3bd66b51d01833f44ec130c0cb">&#9670;&nbsp;</a></span>delayms_counter</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">volatile unsigned long delayms_counter = 1</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>millisecond delay function count variable </p>

<p class="definition">Definition at line <a class="el" href="system_8c_source.html#l00015">15</a> of file <a class="el" href="system_8c_source.html">system.c</a>.</p>

<p class="reference">Referenced by <a class="el" href="system_8c_source.html#l00038">delay_decrement()</a>, and <a class="el" href="system_8c_source.html#l00030">delayms()</a>.</p>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4
</small></address>
</body>
</html>
